<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>质量追溯</title>
    <base href="${request.contextPath}/" />
    <link href="css/reset.css" rel="stylesheet"  type="text/css">
    <link href="css/ProductDisplay.css" rel="stylesheet"  type="text/css">
    <!--banner js-->
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/myJS.js"></script>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/skdslider.min.js"></script>
    <!--end banner js-->
    <!--<script src="/js/jquery.min.js"></script>-->
    <link rel="stylesheet" href="/css/jquery.pagination.css" />
    <link rel="stylesheet" href="/css/list.css">
</head>
<body>
<!--top-->
<div class="header">
    <div id="header"></div>
</div>
<!--banner-->
<div class="banner_tongYong">
    <div class="banner_tongYong_box">
        <div class="i_con_title">
            <h2 class="en_titlestyle1" style="color: #fff"><span class="bold">Product</span> display</h2>
            <h2 class="cn_titlestyle1">产品展示</h2>
            <hr class="hrstyle1">
        </div>
    </div>
</div>


<!--news-->

<div class="product">
    <div class="product_box">
    </div>
    <div class="fenye">
        <div class="box">
            <div id="pagination3" class="page fl"></div>
            <!--<div class="info fl">-->
            <!--<p>当前页数：<span id="current3">4</span></p>-->
            <!--</div>-->
        </div>
    </div>

</div>

<!--footer-->
<footer>
    <#include '/common/footer.html' />
</footer>
<script>
    $(function () {
        $(header).load("/common/top.html?type=产品展示");
//        $(footer).load("/common/footer.html")
    });
</script>
</body>
<script src="/js/jquery.min.js"></script>
<script src="/js/jquery.pagination.min.js"></script>
<script>
    var count = "${count}";
    // 分页
    $(function() {
        var pagination = "{'page': '1','rows': '8','sord': 'desc','sidx': 'create_time'}";
        function createPagination(container){
            console.log(count);
            init(pagination);
            var options = {
                coping:true,    //首页和尾页
                homePage:'首页',
                endPage:'末页',
                prevContent:'上页',
                nextContent:'下页',
                showData:8,    //每页数据条数
                totalPage:Math.ceil(count / 8), //页数
                callback:function(api){
                    pagination = "{'page': '" + $("#pagination3").pagination("getPage").current + "','rows': '8','sord': 'desc','sidx': 'create_time'}";
                    init(pagination);
                }
            };
            $("#"+container).pagination(options);
        }
        function init(pagination){
            $.getJSON('/ProductDisplay/listDoType.html',{'pagination':pagination},function(json){
                console.log(json);
                console.log(json.rows);
                var container =$('.product_box');
                var dataHtml="" ;
                $.each(json.rows, function(index, obj){
                    if(index==0||index==4){
                        dataHtml += '<div class="product_box_con">'
                    }
                    dataHtml +=
                        '<div class="product_box_con_01">'
                        +'<a href="'
                        +'/ProductDisplay/One/'+ obj.ywId
                        +'">'
                        +'<div class="img_up">'
                        /*+'<img src="'+obj.fileEntitiess
                        +'">'*/
                    if(obj.productpictures != null && obj.productpictures.length != 0){
                        dataHtml += '<img src="'+obj.productpictures
                        dataHtml += '">'
                    }else{
                        dataHtml += '<img src="/images/im_1.jpg"></span>'
                    }
                    dataHtml +='</div>'
                        +'<div class="img_dwon">'
                        +'<h4>'
                        + obj.productName
                        +'</h4>'
                        +'<p>'
                        +'<span></span>'
                            if(obj.province != null&&obj.province.length !=0){
                                dataHtml +=obj.province
                            }if(obj.city!=null&&obj.city.length !=0){
                                dataHtml += obj.city
                            }if(obj.county !=null&&obj.county.length !=0){
                                dataHtml +=obj.county
                            }if(obj.town !=null&&obj.town.length !=0){
                                dataHtml +=obj.town
                            }if(obj.village !=null&&obj.village.length !=0){
                                dataHtml +=obj.village
                            }

                    dataHtml += obj.placeOfOrigin
                        +'</p>'
                        +'</div>'
                        +'</a>'
                        +'</div>';
                    if(index==3||index==7){
                        dataHtml += '</div>'
                    }
                });
                container.html(dataHtml);
            });
        }
        createPagination("pagination3")
    });

</script>
</html>